
<?php

$id = $_GET['id']; //获取地址栏中参数名是id的值


if(!empty($_POST)){


/*
  $username = $_POST['username'];
  $name = $_POST['name'];
  $sex = $_POST['sex'];
  $age = $_POST['age'];
  $tel = $_POST['tel'];
  $address = $_POST['address'];

  //修改语句
  //update `v9_linkage` set style = 0 where linkageid = 22
  $sql = " update `admin` set `username`='$username',`name`='$name',`sex`='$sex',`age`='$age',`tel`='$tel',`address`='$address' where `id`=$id";

  //执行语句
  mysqli_query($link,$sql);
  //提取真值
  $_rows = mysqli_affected_rows($link);  //-1   0   1
*/

  $_rows = edit('admin',$id,$_POST);

  if($_rows>=0){
     echo"<script>alert('编辑成功');location.href='index.php?c=admin&a=list&admin=1'</script>";die;
  }else{
     echo"<script>alert('编辑失败');history.go(-1)</script>";die;
  }

}
 //查询语句
/*  $sql = "select * from `admin` where `id`=$id";

  //执行语句
  $result = mysqli_query($link,$sql);

  $data = mysqli_fetch_assoc($result);
*/
  $data = getSelectByOne('admin',"id=$id");

//加载后台公共视图
 include (View_PATH.$admin.'/communal.html');


?>

